#!/bin/bash
yum update && yum install curl -y && yum install socat –y
curl https://get.acme.sh | sh -s email=gjkevin@163.com
~/.acme.sh/acme.sh --upgrade --auto-upgrade
export Ali_Key='LTAIaErYIr6IubWT'
export Ali_Secret='M5c575MQIgZRm5z6kA9aKEhHKbQWFN'
~/.acme.sh/acme.sh --issue -d whxukang.cn -d *.whxukang.cn --dns dns_ali

#installcert
~/.acme.sh/acme.sh --installcert -d whxukang.cn \
        --key-file   /usr/share/nginx/html/flasky/xkdichan/whxukang.cn.key \
        --fullchain-file /usr/share/nginx/html/flasky/xkdichan/fullchain.cer \
        --reloadcmd  "service nginx force-reload"

#for jupyter
~/.acme.sh/acme.sh --installcert -d whxukang.cn \
        --key-file   /root/jupyter/privkey.pem \
        --fullchain-file /root/jupyter/fullchain.pem \
        --reloadcmd  "service nginx force-reload"

#for Rss
~/.acme.sh/acme.sh --installcert -d whxukang.cn \
        --key-file   /usr/share/nginx/html/RSS/privkey.pem \
        --fullchain-file /usr/share/nginx/html/RSS/fullchain.pem \
        --reloadcmd  "service nginx force-reload"

# restart flask
source /usr/share/nginx/html/flasky/xkdichan/venv/bin/activate
uwsgi -ini /usr/share/nginx/html/flasky/xkdichan/uwsgi/uwsgi.ini
